<?php namespace system\model;
use houdunwang\model\Model;
class Link extends Model{
	//数据表
	protected $table = "link";

	//允许填充字段
	protected $allowFill = ['*' ];


	//自动验证
	protected $validate=[
		//['字段名','验证方法','提示信息',验证条件,验证时间]
		['lname','isnull','请填写友情链接名称',self::MUST_VALIDATE,self::MODEL_BOTH],
		['logo','isnull','请上传logo',self::MUST_VALIDATE,self::MODEL_BOTH],
		['url','http','请填写正确的链接地址',self::MUST_VALIDATE,self::MODEL_BOTH],
		['sort','num:1,9999','排序必须为数字',self::MUST_VALIDATE,self::MODEL_BOTH],
	];

	//自动完成
	protected $auto=[
		//['字段名','处理方法','方法类型',验证条件,验证时机]
		['addtime','time','function',self::MUST_AUTO,self::MODEL_BOTH],
	];


	/**
	 * 添加
	 */
	public function store()
	{
		//p($_POST);die;
		return $this->save($_POST);
	}
}